<?php
	session_start(); 
	if(isset($_SESSION['poll'])&&(time()-$_SESSION['poll']<=3)){
  	header('Location: 404');
  }
	else{
  	$_SESSION['poll']= time();
	}

?>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	</head>
	<body>
<?php
	require_once("../admin/action/sys_conf.inc");
	$link_id = mysql_connect($DBHOST,$DBUSER,$DBPWD);
	mysql_select_db($DBNAME);
	mysql_query("SET NAMES 'utf8'");
	$id = $_GET[id];
	$userId = 1;//根据其他程序找到uid
	$sql = "UPDATE extpollitems SET amount = amount+1 WHERE id = '$id'";
	mysql_query($sql);
	$pollTime = date("Y-m-d H:i:s");
	$sql2 = "insert into extpolldetail(subjectItemId,userId,pollTime) values('$id','$userId','$pollTime')";
	mysql_query($sql2);
	$sql3 = "SELECT amount FROM extpollitems where id = '$id'";
	$rs = mysql_query($sql3) or die(mysql_error());
	$pn = mysql_fetch_assoc($rs);
	$amount = $pn[amount];
	echo $amount."票";
	mysql_close();
?>
</body></html>